<style scoped>

    #tableStyleBizPoint + .layui-table-view .layui-table-body tbody > tr > td > .layui-table-cell {
        height: auto;
        line-height: 30px;
        padding: 0 5px;
    }

    .tdImg {
        width: 35px;
        max-width: none;
        cursor: pointer;
    }

    .layui-table-view {
        margin: 0;
    } 
</style>
<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="layui-form toolbar">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label w-auto">搜索：</label>
                        <div class="layui-input-inline mr0">
                            <input id="edtSearchAuth" class="layui-input" type="text" placeholder="输入关键字"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button id="btnSearchBizEvent" class="layui-btn icon-btn"><i class="layui-icon">&#xe615;</i>搜索
                        </button>
                        <button id="btnAddBizEvent" class="layui-btn icon-btn"><i class="layui-icon">&#xe654;</i>添加</button>
                        <button id="btnExpandBizEvent" class="layui-btn icon-btn">全部展开</button>
                    </div>
                    <div class="layui-inline">
                        <button id="btnFoldBizEvent" class="layui-btn icon-btn">全部折叠</button>
                    </div>
                </div>
            </div>

            <table class="layui-table" id="tableBizEvent" lay-filter="tableBizEvent"></table>
        </div>
    </div>
</div>

<!-- 表格操作列 -->
<script type="text/html" id="tableBarBizEvent">
#[[  {{#  if(d.parentId === 'root'){ }}
		 <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">编辑</a>
		 <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
		 <a class="layui-btn layui-btn-xs" lay-event="event">事件</a>
  {{#  } else { }}
       <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="editEvent">编辑</a>
       <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
       <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="eventStyle">样式</a>
  {{#  } }}
]]#



</script>
<!-- 表单弹窗 -->
<script type="text/html" id="modelBizEvent">
    <form id="modelBizEventForm" lay-filter="modelBizEventForm" class="layui-form model-form">
        <input name="id" type="hidden"/>
		<input name="type" type="hidden" value="0"/>
        <div class="layui-form-item">
            <label class="layui-form-label">名称</label>
            <div class="layui-input-block">
                <input name="name" placeholder="请输入名称" type="text" class="layui-input" maxlength="50"
                       lay-verType="tips" lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">标识</label>
            <div class="layui-input-block">
                <input name="code" placeholder="请输入标识" type="text" class="layui-input" maxlength="50" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">类型</label>
            <div class="layui-input-block">
			      <select name="type" lay-filter="type"  lay-verify="required" required>
			        <option value="">--请选择--</option>
			        <option value="Point">Point</option>
			        <option value="Line">Line</option>
			      </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">序号</label>
            <div class="layui-input-block">
                <input name="sort" placeholder="请输入序号" type="text" class="layui-input"/>
            </div>
        </div>
        <div class="layui-form-item text-right">
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
            <button class="layui-btn" lay-filter="modelSubmitBizEvent" lay-submit>保存</button>
        </div>
    </form>
</script>


<script type="text/html" id="modelBizEventForTopic">
    <form id="modelBizEventForTopicForm" lay-filter="modelBizEventForTopicForm" class="layui-form model-form">
        <input name="id" type="hidden"/>
		<input name="type" type="hidden" value="1"/>
        <div class="layui-form-item">
            <label class="layui-form-label">事件名称</label>
            <div class="layui-input-block">
                <input name="name" placeholder="请输入事件名称" type="text" class="layui-input" maxlength="50"
                       lay-verType="tips" lay-verify="required" required/>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">事件标识</label>
            <div class="layui-input-block">
                <input name="code" placeholder="请输入事件标识" type="text" class="layui-input"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">序号</label>
            <div class="layui-input-block">
                <input name="sort" placeholder="请输入序号" type="text" class="layui-input"/>
            </div>
        </div>
		<div class="layui-form-item">
            <label class="layui-form-label">颜色</label>
            <div class="layui-input-block">
                <input type="hidden" name="color" id="colorForEvent-input">
				<div id="colorForEvent"></div>
            </div>
        </div>
        <div class="layui-form-item text-right">
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
            <button class="layui-btn" lay-filter="modelSubmitBizEventForTopic" lay-submit>保存</button>
        </div>
    </form>
</script>

<!-- 表单弹窗 -->
 <script type="text/html" id="modelBizLayerStyle">
	<div class="layui-tab layui-tab-card" style="margin:0px;margin-top:1px;box-shadow: none;">
	  <ul class="layui-tab-title">
	    <li class="layui-this">点</li>
	    <li>线</li>
	    <li>面</li>
	  </ul>
	  <div class="layui-tab-content" style="padding: 0px;">
	    <div class="layui-tab-item layui-show">
			<div class="layui-form toolbar">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label w-auto">搜索：</label>
                        <div class="layui-input-inline mr0">
                            <input name="name" class="layui-input" type="text" placeholder="输入关键字"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button lay-filter="btnSearchPointStyle" class="layui-btn icon-btn" lay-submit><i class="layui-icon">&#xe615;</i>搜索</button>
                    </div>
                </div>
            </div>
			<table class="layui-table" id="tableStyleBizPoint" lay-filter="tableStyleBizPoint" style="margin: 1px;"></table>
			<div class="layui-inline" style="padding-right: 0px;margin-right: 0px;margin: 5px;float: right;">
				<button class="layui-btn icon-btn layui-btn-sm" id="bizPointDefaultStyleBtn">
					<i class="layui-icon">&#xe605;</i>默认
				</button>
				<button class="layui-btn icon-btn layui-btn-sm" id="bizPointHoverStyleBtn">
					<i class="layui-icon">&#xe605;</i>悬浮
				</button>
				<button class="layui-btn icon-btn layui-btn-sm" id="bizPointSelectedStyleBtn">
					<i class="layui-icon">&#xe605;</i>选中
				</button>
			</div>
		</div>
	    <div class="layui-tab-item">
			<div class="layui-form toolbar">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label w-auto">搜索：</label>
                        <div class="layui-input-inline mr0">
                            <input name="name" class="layui-input" type="text" placeholder="输入关键字"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button lay-filter="btnSearchLineStyle" class="layui-btn icon-btn" lay-submit><i class="layui-icon">&#xe615;</i>搜索</button>
                    </div>
                </div>
            </div>
			<table class="layui-table" id="tableBizStyleLine" lay-filter="tableBizStyleLine" style="margin: 1px;"></table>
			<div class="layui-inline" style="padding-right: 0px;margin-right: 0px;margin: 5px;float: right;">
				<button class="layui-btn icon-btn layui-btn-sm" id="bizLineDefaultStyleBtn">
					<i class="layui-icon">&#xe605;</i>默认
				</button>
				<button class="layui-btn icon-btn layui-btn-sm" id="bizLineHoverStyleBtn">
					<i class="layui-icon">&#xe605;</i>悬浮
				</button>
				<button class="layui-btn icon-btn layui-btn-sm" id="bizLineSelectedStyleBtn">
					<i class="layui-icon">&#xe605;</i>选中
				</button>
			</div>
		</div>
	    <div class="layui-tab-item">
			<div class="layui-form toolbar">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label w-auto">搜索：</label>
                        <div class="layui-input-inline mr0">
                            <input name="name" class="layui-input" type="text" placeholder="输入关键字"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button lay-filter="btnSearchPolygonStyle" class="layui-btn icon-btn" lay-submit><i class="layui-icon">&#xe615;</i>搜索</button>
                    </div>
                </div>
            </div>
			<table class="layui-table" id="tableBizStylePolygon" lay-filter="tableBizStylePolygon" style="margin: 1px;"></table>
			<div class="layui-inline" style="padding-right: 0px;margin-right: 0px;margin: 5px;float: right;">
				<button class="layui-btn icon-btn layui-btn-sm" id="bizPolygonDefaultStyleBtn">
					<i class="layui-icon">&#xe605;</i>默认
				</button>
				<button class="layui-btn icon-btn layui-btn-sm" id="bizPolygonHoverStyleBtn">
					<i class="layui-icon">&#xe605;</i>悬浮
				</button>
				<button class="layui-btn icon-btn layui-btn-sm" id="bizPolygonSelectedStyleBtn">
					<i class="layui-icon">&#xe605;</i>选中
				</button>

			</div>
		</div>
	  </div>
	</div>   
</script>


<!-- js部分 -->
<script>
layui.extend({
    treeSelect: '/treeSelect/treeSelect'
}).use(['layer', 'form', 'table', 'admin', 'treetable', 'config','treeSelect','colorpicker'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var admin = layui.admin;
        var treetable = layui.treetable;
        var config = layui.config;
        var treeSelect=layui.treeSelect;
        var colorpicker = layui.colorpicker;

        // 渲染表格
        function renderTable() {
            treetable.render({
                treeColIndex: 1,
                treeSpid: 'root',
                treeIdName: 'id',
                treePidName: 'parentId',
                elem: '#tableBizEvent',
                url:'#(ctx)/biz/event/listData',
                cellMinWidth: 100,
                cols: [[
                    {type: 'numbers'},
                    {field: 'name', title: '事件名称', minWidth: 200},
                    {field: 'code', title: '事件标识'},
                    {templet: '#tableBarBizEvent', title: '操作', align: 'center', minWidth: 120}
                ]]
            });
        }

        renderTable();

        // 添加按钮点击事件
        $('#btnAddBizEvent').click(function () {
            showEditModel();
        });

        // 工具条点击事件
        table.on('tool(tableBizEvent)', function (obj) {
            var data = obj.data;
            var layEvent = obj.event;
            if (layEvent === 'edit') { // 修改
                showEditModel(data);
            } else if (layEvent === 'del') { // 删除
                doDel(data);
            }
            else if (layEvent === 'event') { // 添加事件
            	showEditModelForEvent(data.id,null);
            }
            else if (layEvent === 'editEvent') { // 编辑事件
            	showEditModelForEvent(null,data);
            }
            else if (layEvent === 'eventStyle') { // 编辑事件
            	settingStyle(data);
            }
        });

        // 删除
        function doDel(data) {
            layer.confirm('确定要删除“【<span style="color:red;">' + data.name + '</span>】”吗？', {
                skin: 'layui-layer-admin',
                shade: .1
            }, function (index) {
                layer.close(index);
                layer.load(2);
                admin.req('biz/event/delete', {
                    id: data.id
                }, function (res) {
                    layer.closeAll('loading');
                    if (res.code == 200) {
                        layer.msg(res.message, {icon: 1});
                        renderTable();
                    } else {
                        layer.msg(res.message, {icon: 2});
                    }
                }, 'get');
            });
        }

        // 显示表单弹窗
        function showEditModel(bizEvent) {
            admin.open({
                type: 1,
                title: (bizEvent ? '修改' : '添加'),
                content: $('#modelBizEvent').html(),
                area:'400px',
                success: function (layero, dIndex) {
                    $(layero).children('.layui-layer-content').css('overflow', 'visible');
                    var url = 'biz/event/save';
                    form.val('modelBizEventForm', bizEvent);  // 回显数据
                    
                    // 表单提交事件
                    form.on('submit(modelSubmitBizEvent)', function (data) {
                        data.field.parentId = 'root';
                        layer.load(2);
                        var formData={}; 
                        for(var key in data.field){
                        	formData['bizEvent.'+key]=data.field[key];
                        }
                        admin.req(url,formData, function (res) {
                            layer.closeAll('loading');
                            if (res.code == 200) {
                                layer.close(dIndex);
                                layer.msg(res.message, {icon: 1});
                                renderTable();
                            } else {
                                layer.msg(res.message, {icon: 2});
                            }
                        }, 'get');
                        return false;
                    });
                }
            });
        }
        
        function showEditModelForEvent(parentId,topic) {
            admin.open({
                type: 1,
                title: (topic ? '修改' : '添加'),
                content: $('#modelBizEventForTopic').html(),
                area:'400px',
                success: function (layero, dIndex) {
                    $(layero).children('.layui-layer-content').css('overflow', 'visible');
                    var url = 'biz/event/save';
                    form.val('modelBizEventForTopicForm', topic);  // 回显数据
                    
                    colorpicker.render({//点颜色
                		elem: '#colorForEvent',
                		color: (topic&&topic.color)?topic.color:null,
                		format: 'rgb',
                		predefine: true,
                		alpha: true,
                		done: function(color) {
                			$('#colorForEvent-input').val(color); //向隐藏域赋值
                			color || this.change(color); //清空时执行 change
                		},
                		change: function(color) {}
                	});
                    
                    // 表单提交事件
                    form.on('submit(modelSubmitBizEventForTopic)', function (data) {
                        if (parentId) {
                            data.field.parentId = parentId;
                        }
                        layer.load(2);
                        var formData={}; 
                        for(var key in data.field){
                        	formData['bizEvent.'+key]=data.field[key];
                        }
                        admin.req(url,formData, function (res) {
                            layer.closeAll('loading');
                            if (res.code == 200) {
                                layer.close(dIndex);
                                layer.msg(res.message, {icon: 1});
                                renderTable();
                            } else {
                                layer.msg(res.message, {icon: 2});
                            }
                        }, 'get');
                        return false;
                    });
                }
            });
        }
        
        function showEditModelForEventStyle(parentId,topic) {
            admin.open({
                type: 1,
                title: (topic ? '修改' : '添加'),
                content: $('#modelBizEventForTopic').html(),
                area:'400px',
                success: function (layero, dIndex) {
                    $(layero).children('.layui-layer-content').css('overflow', 'visible');
                }
            });
        }
        
        
        
        // 搜索按钮点击事件
        $('#btnSearchBizEvent').click(function () {
            $('#edtSearchAuth').removeClass('layui-form-danger');
            var keyword = $('#edtSearchAuth').val();
            var $tds = $('#tableBizEvent').next('.treeTable').find('.layui-table-body tbody tr td');
            $tds.css('background-color', 'transparent');
            if (!keyword) {
                layer.msg("请输入关键字", {icon: 5, anim: 6});
                $('#edtSearchAuth').addClass('layui-form-danger');
                $('#edtSearchAuth').focus();
                return;
            }
            var searchCount = 0;
            $tds.each(function () {
                if ($(this).text().indexOf(keyword) >= 0) {
                    $(this).css('background-color', '#FAE6A0');
                    if (searchCount == 0) {
                        $('body,html').stop(true);
                        $('body,html').animate({scrollTop: $(this).offset().top - 150}, 500);
                    }
                    searchCount++;
                }
            });
            if (searchCount == 0) {
                layer.msg("没有匹配结果", {icon: 5, anim: 6});
            } else {
                treetable.expandAll('#tableBizEvent');
            }
        });

        $('#btnExpandBizEvent').click(function () {
            treetable.expandAll('#tableBizEvent');
        });

        $('#btnFoldBizEvent').click(function () {
            treetable.foldAll('#tableBizEvent');
        });
        
      //设置样式
    	function settingStyle(data){
            layer.open({
                type: 1,
                title: '图层样式',
                content: $('#modelBizLayerStyle').html(),
                area:'400px',
                offset: 't',
                success: function (layero, dIndex) {
               	 	$(layero).children('.layui-layer-content').css('overflow', 'visible');
    	            var insTbForBizPointIcon = table.render({
    	                elem: '#tableStyleBizPoint',
    	                url: '#(ctx)/biz/style/point/listData', 
    	                page: true,
    	                cellMinWidth: 100,
    	                height: 700,
    	                cols: [[
    	                    {type:'radio'},
    	                    {
    	                        align: 'center', templet: function (d) {
    	                        	if(d.imageForBillboard)
    	                            	return '<img src="#(ctx)'+d.imageForBillboard+'" />';
    	                            else
    	                            	return '';
    	                        }, title: '缩略图', width: 100, unresize: true
    	                    },
    	                    {field: 'name', sort: false, title: '名称'},
    	                ]]
    	            });
    	            
    	         	// 搜索
    	            form.on('submit(btnSearchPointStyle)', function (data) {
    	            	insTbForBizPointIcon.reload({where: data.field}, 'data');
    	            });
    	            
    	            //默认样式
    	    		$('#bizPointDefaultStyleBtn').click(function () {
    	    			var checkStatus = table.checkStatus("tableStyleBizPoint"); //获取选中行状态
    	    	        var styles = checkStatus.data;  //获取选中行数据
    	    	        if(styles && styles.length>0){
    	    	        	layer.load(2);
    	    	            var formData={}; 
    	    	            formData['bizEvent.id']=data.id;
                            formData['bizEvent.defaultStyleId']=styles[0].id;
    	    	            common_ajax.ajaxAsyncFunc("#(ctx)/biz/event/save",formData, "json", function(res){
    	    		            layer.closeAll('loading');
    	    		            if (undefined!=res && 200==res.code) {
    	    		                layer.msg(res.message, {icon: 1});
    	    		            } else {
    	    		                layer.msg(res.message, {icon: 2});
    	    		            }
    	    		        	layer.close(dIndex);
    	    	            });
    	    	        }else{
    	    	        	layer.msg("请选择样式!!!", {icon: 3});
    	    	        }
    	    	        return false;
        			});
    	            
    	            //悬浮
    	    		$('#bizPointHoverStyleBtn').click(function () {
    	    			var checkStatus = table.checkStatus("tableStyleBizPoint"); //获取选中行状态
    	    	        var styles = checkStatus.data;  //获取选中行数据
    	    	        if(styles && styles.length>0){
    	    	        	layer.load(2);
    	    	        	var formData={}; 
    	    	            formData['bizEvent.id']=data.id;
                            formData['bizEvent.hoverStyleId']=styles[0].id;
    	    	            common_ajax.ajaxAsyncFunc("#(ctx)/biz/event/save",formData, "json", function(res){
    	    		            layer.closeAll('loading');
    	    		            if (undefined!=res && 200==res.code) {
    	    		                layer.msg(res.message, {icon: 1});
    	    		            } else {
    	    		                layer.msg(res.message, {icon: 2});
    	    		            }
    	    		        	layer.close(dIndex);
    	    	            });
    	    	        }else{
    	    	        	layer.msg("请选择样式!!!", {icon: 3});
    	    	        }
    	    	        return false;
        			});
    	            
    	            //选中
    	    		$('#bizPointSelectedStyleBtn').click(function () {
    	    			var checkStatus = table.checkStatus("tableStyleBizPoint"); //获取选中行状态
    	    	        var styles = checkStatus.data;  //获取选中行数据
    	    	        if(styles && styles.length>0){
    	    	        	layer.load(2);
    	    	        	var formData={}; 
    	    	            formData['bizEvent.id']=data.id;
                            formData['bizEvent.selectedStyleId']=styles[0].id;
    	    	            common_ajax.ajaxAsyncFunc("#(ctx)/biz/event/save",formData, "json", function(res){
    	    		            layer.closeAll('loading');
    	    		            if (undefined!=res && 200==res.code) {
    	    		                layer.msg(res.message, {icon: 1});
    	    		            } else {
    	    		                layer.msg(res.message, {icon: 2});
    	    		            }
    	    		        	layer.close(dIndex);
    	    	            });
    	    	        }else{
    	    	        	layer.msg("请选择样式!!!", {icon: 3});
    	    	        }
    	    	        return false;
        			});	
    	            
    	    		
    	            var insLineStyleTb = table.render({
    	                elem: '#tableBizStyleLine',
    	                url: '#(ctx)/biz/style/line/listData', 
    	                page: true,
    	                toolbar: false,
    	                cellMinWidth: 100,
    	                cols: [[
    	                	{type:'radio'},
    	                    {field: 'name', sort: false, title: '名称'},
    	                ]],
    	            });
    	            
    	            form.on('submit(btnSearchLineStyle)', function (data) {
    	            	insLineStyleTb.reload({where: data.field}, 'data');
    	            });
    	            
    	            //默认样式
    	    		$('#bizLineDefaultStyleBtn').click(function () {
    	    			var checkStatus = table.checkStatus("tableBizStyleLine"); //获取选中行状态
    	    	        var styles = checkStatus.data;  //获取选中行数据
    	    	        if(styles && styles.length>0){
    	    	        	layer.load(2);
    	    	            var formData={}; 
    	    	            formData['layerId']=data.id;
    	    	            formData['styleId']=styles[0].id;
    	    	            formData['event']='DEFAULT';
    	    	            common_ajax.ajaxAsyncFunc("#(ctx)/biz/marker/line/batchSaveStyle",formData, "json", function(res){
    	    		            layer.closeAll('loading');
    	    		            if (undefined!=res && 200==res.code) {
    	    		                layer.msg(res.message, {icon: 1});
    	    		            } else {
    	    		                layer.msg(res.message, {icon: 2});
    	    		            }
    	    		        	layer.close(dIndex);
    	    	            });
    	    	        }else{
    	    	        	layer.msg("请选择样式!!!", {icon: 3});
    	    	        }
    	    	        return false;
        			});
    	            
    	            //悬浮
    	    		$('#bizLineHoverStyleBtn').click(function () {
    	    			var checkStatus = table.checkStatus("tableBizStyleLine"); //获取选中行状态
    	    	        var styles = checkStatus.data;  //获取选中行数据
    	    	        if(styles && styles.length>0){
    	    	        	layer.load(2);
    	    	            var formData={}; 
    	    	            formData['layerId']=data.id;
    	    	            formData['styleId']=styles[0].id;
    	    	            formData['event']='HOVER';
    	    	            common_ajax.ajaxAsyncFunc("#(ctx)/biz/marker/line/batchSaveStyle",formData, "json", function(res){
    	    		            layer.closeAll('loading');
    	    		            if (undefined!=res && 200==res.code) {
    	    		                layer.msg(res.message, {icon: 1});
    	    		            } else {
    	    		                layer.msg(res.message, {icon: 2});
    	    		            }
    	    		        	layer.close(dIndex);
    	    	            });
    	    	        }else{
    	    	        	layer.msg("请选择样式!!!", {icon: 3});
    	    	        }
    	    	        return false;
        			});
    	            
    	            //选中
    	    		$('#bizLineSelectedStyleBtn').click(function () {
    	    			var checkStatus = table.checkStatus("tableBizStyleLine"); //获取选中行状态
    	    	        var styles = checkStatus.data;  //获取选中行数据
    	    	        if(styles && styles.length>0){
    	    	        	layer.load(2);
    	    	            var formData={}; 
    	    	            formData['layerId']=data.id;
    	    	            formData['styleId']=styles[0].id;
    	    	            formData['event']='SELECTED';
    	    	            common_ajax.ajaxAsyncFunc("#(ctx)/biz/marker/line/batchSaveStyle",formData, "json", function(res){
    	    		            layer.closeAll('loading');
    	    		            if (undefined!=res && 200==res.code) {
    	    		                layer.msg(res.message, {icon: 1});
    	    		            } else {
    	    		                layer.msg(res.message, {icon: 2});
    	    		            }
    	    		        	layer.close(dIndex);
    	    	            });
    	    	        }else{
    	    	        	layer.msg("请选择样式!!!", {icon: 3});
    	    	        }
    	    	        return false;
        			});	
    	    		
    	    		
    	    		
    	            var insPolygonStyleTb = table.render({
    	                elem: '#tableBizStylePolygon',
    	                url: '#(ctx)/biz/style/polygon/listData', 
    	                page: true,
    	                toolbar: false,
    	                cellMinWidth: 100,
    	                cols: [[
    	                	{type:'radio'},
    	                    {field: 'name', sort: false, title: '名称'},
    	                ]],
    	            });
    	            
    	            form.on('submit(btnSearchPolygonStyle)', function (data) {
    	            	insPolygonStyleTb.reload({where: data.field}, 'data');
    	            });
    	            
    	            //默认样式
    	    		$('#bizPolygonDefaultStyleBtn').click(function () {
    	    			var checkStatus = table.checkStatus("tableBizStylePolygon"); //获取选中行状态
    	    	        var styles = checkStatus.data;  //获取选中行数据
    	    	        if(styles && styles.length>0){
    	    	        	layer.load(2);
    	    	            var formData={}; 
    	    	            formData['layerId']=data.id;
    	    	            formData['styleId']=styles[0].id;
    	    	            formData['event']='DEFAULT';
    	    	            common_ajax.ajaxAsyncFunc("#(ctx)/biz/marker/polygon/batchSaveStyle",formData, "json", function(res){
    	    		            layer.closeAll('loading');
    	    		            if (undefined!=res && 200==res.code) {
    	    		                layer.msg(res.message, {icon: 1});
    	    		            } else {
    	    		                layer.msg(res.message, {icon: 2});
    	    		            }
    	    		        	layer.close(dIndex);
    	    	            });
    	    	        }else{
    	    	        	layer.msg("请选择样式!!!", {icon: 3});
    	    	        }
    	    	        return false;
        			});
    	            
    	            //悬浮
    	    		$('#bizPolygonHoverStyleBtn').click(function () {
    	    			var checkStatus = table.checkStatus("tableBizStylePolygon"); //获取选中行状态
    	    	        var styles = checkStatus.data;  //获取选中行数据
    	    	        if(styles && styles.length>0){
    	    	        	layer.load(2);
    	    	            var formData={}; 
    	    	            formData['layerId']=data.id;
    	    	            formData['styleId']=styles[0].id;
    	    	            formData['event']='HOVER';
    	    	            common_ajax.ajaxAsyncFunc("#(ctx)/biz/marker/polygon/batchSaveStyle",formData, "json", function(res){
    	    		            layer.closeAll('loading');
    	    		            if (undefined!=res && 200==res.code) {
    	    		                layer.msg(res.message, {icon: 1});
    	    		            } else {
    	    		                layer.msg(res.message, {icon: 2});
    	    		            }
    	    		        	layer.close(dIndex);
    	    	            });
    	    	        }else{
    	    	        	layer.msg("请选择样式!!!", {icon: 3});
    	    	        }
    	    	        return false;
        			});
    	            
    	            //选中
    	    		$('#bizPolygonSelectedStyleBtn').click(function () {
    	    			var checkStatus = table.checkStatus("tableBizStylePolygon"); //获取选中行状态
    	    	        var styles = checkStatus.data;  //获取选中行数据
    	    	        if(styles && styles.length>0){
    	    	        	layer.load(2);
    	    	            var formData={}; 
    	    	            formData['layerId']=data.id;
    	    	            formData['styleId']=styles[0].id;
    	    	            formData['event']='SELECTED';
    	    	            common_ajax.ajaxAsyncFunc("#(ctx)/biz/marker/polygon/batchSaveStyle",formData, "json", function(res){
    	    		            layer.closeAll('loading');
    	    		            if (undefined!=res && 200==res.code) {
    	    		                layer.msg(res.message, {icon: 1});
    	    		            } else {
    	    		                layer.msg(res.message, {icon: 2});
    	    		            }
    	    		        	layer.close(dIndex);
    	    	            });
    	    	        }else{
    	    	        	layer.msg("请选择样式!!!", {icon: 3});
    	    	        }
    	    	        return false;
        			});
                }
            });
    	}

    });
</script>